package com.funny.stock.trade.controller;

import com.funny.stock.base.util.ResultUtil;
import com.funny.stock.base.vo.Result;
import com.funny.stock.data.collect.impl.StockDataManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author pengl
 * @date 2020/11/27
 */
@RestController
@RequestMapping("/openapi")
public class OpenApiController {

    @Autowired
    StockDataManager stockDataManager;

    @GetMapping("/status")
    public Result status(){
        boolean trading = stockDataManager.isTrading();

        Map<String,Boolean> map = new HashMap<>();
        map.put("isTrading", trading);

        return ResultUtil.success(map);
    }
}
